/*
 * @Author: wangc
 * @Date: 2020-07-29 10:04:12
 * @LastEditTime: 2020-08-30 16:39:23
 * @Description: 用来存放封装的api接口，用来向服务端请求数据
 */

import request from '../utils/axiosUtil' //引入封装好的 axios 请求
/**
 * 登录接口
 * @param {} uid 
 * @param {*} psd 
 * @returns 
 */
export function login(uid, psd) { //登录接口
    let data = {
        username: uid,
        password: psd
    }
    return request.post("/login", data)
}
/**
 * 注册接口
 * @param {} username 
 * @param {*} password 
 * @param {*} email 
 * @param {*} createTime 
 * @returns 
 */
export function register(username, password, email, createTime) { //登录接口
    let data = {
        username: username,
        password: password,
        email: email,
        createTime: createTime
    }
    return request.post("/register", data)
}
/**
 * 留言接口
 * @param {*} data 
 * @returns 
 */
export function insertMessage(data) {
    return request.post("/insertMessage", data)
}
/**
 * 获取所有的用户信息
 * @returns 
 */
export function getAllUser() {
    return request.post("/getAllUser");
}
/**
 * 获取所有的留言信息
 * @returns 
 */
export function getAllMessage() {
    return request.post("/getAllMessage");
}
/**
 * 根据id删除留言
 * @param {*} data 
 * @returns 
 */
export function deleteMessage(data) {
    return request.get("/deleteMessage?id=" + data);
}
/**
 * 根据id删除用户
 * @param {*} data 
 * @returns 
 */
export function deleteUser(data) {
    return request.get("/deleteUser?id=" + data);
}